/**
 * Created by Cake on 2017/6/6.
 */


$(function () {

    $('.store-car').click(function () {
        if (!$('.store-car-dialog').hasClass('dialog-open')) {
            $('.store-car-dialog').addClass('dialog-open');
        } else {
            $('.store-car-dialog').removeClass('dialog-open');
        }
    });

    $('.store-car-dialog').click(function () {
        $('.store-car-dialog').removeClass('dialog-open');
    });

    $('.store-car-box').click(function (e) {
        e.stopPropagation();
    });

    //$('.store-detail-nav').mCustomScrollbar({
    //    theme:'minimal-dark'
    //});
    //
    //$('.store-detail-nav a').click(function () {
    //    var flag = $(this).attr('id');
    //    $('.store-detail-con').mCustomScrollbar('scrollTo','.'+ flag);
    //});
    //
    //$('.store-detail-con').mCustomScrollbar({
    //    theme:'minimal-dark',
    //    callbacks:{
    //        whileScrolling:function(){
    //            var flag = $('.store-detail-nav-on').attr('id');
    //            var scrollHeight = this.mcs.top;
    //            var dom = $('.' + flag).prevAll();
    //            var navHeight = $('.store-detail-nav li:first-child').height();
    //            var height = 0;
    //            var now = $('.store-detail-nav-on').parent().index();
    //            dom.each(function () {
    //                height += parseInt($(this).height());
    //            });
    //
    //            var totalHeight = height + parseInt($('.' + flag).height());
    //
    //            console.log(scrollHeight);
    //
    //            if (-scrollHeight >= height) {
    //                if (-scrollHeight >= totalHeight) {
    //                    $('.store-detail-nav li').eq(now).find('a').removeClass('store-detail-nav-on');
    //                    if (now >= 5) {
    //                        $('.store-detail-nav').mCustomScrollbar('scrollTo', navHeight*(now - 4));
    //                    }
    //                    $('.store-detail-nav li').eq(now + 1).find('a').addClass('store-detail-nav-on');
    //                }
    //            } else {
    //                $('.store-detail-nav li').eq(now).find('a').removeClass('store-detail-nav-on');
    //
    //                if (now >= 6) {
    //                    $('.store-detail-nav').mCustomScrollbar('scrollTo', navHeight * (now - 6));
    //                }
    //
    //                $('.store-detail-nav li').eq(now - 1).find('a').addClass('store-detail-nav-on');
    //            }
    //
    //
    //        },
    //        whileScrollingInterval:30
    //    }
    //});

});